const app = getApp();
const util = require('../../../../utils/util.js');
const api = require('../../../../config/api.js');
Page({

  /**
   * 页面的初始数据
   */
  data: {
    //获取从哪个标签进入的
    q_id: '',
    //获取类目名称
    tagname: '',
    //获取进入时间
    time: "2019-4-2",
    //演示数据
    phList: [{ "userImg": "https://image.xingqubaike.com:8443/minicard/home/beijingtu.png", "userTitle": "一二三四五六七八九十一二","userPrice":"9999"},
      { "userImg": "https://image.xingqubaike.com:8443/minicard/home/beijingtu.png", "userTitle": "占格子", "userPrice": "9999"},
      { "userImg": "https://image.xingqubaike.com:8443/minicard/home/beijingtu.png", "userTitle": "占格子", "userPrice": "9999"},
      { "userImg": "https://image.xingqubaike.com:8443/minicard/home/beijingtu.png", "userTitle": "占格子", "userPrice": "9999"},
      { "userImg": "https://image.xingqubaike.com:8443/minicard/home/beijingtu.png", "userTitle": "占格子", "userPrice": "9999" },
      { "userImg": "https://image.xingqubaike.com:8443/minicard/home/beijingtu.png", "userTitle": "占格子", "userPrice": "9999" },
      { "userImg": "https://image.xingqubaike.com:8443/minicard/home/beijingtu.png", "userTitle": "占格子", "userPrice": "9999" },
      { "userImg": "https://image.xingqubaike.com:8443/minicard/home/beijingtu.png", "userTitle": "占格子", "userPrice": "9999" }]
  },
  //监听页面加载
  onLoad: function (options) {
    var _this = this
    var pid = options.q_id
    _this.setData({
      q_id: pid
    })
    console.log(_this.data.q_id)
    util.post(api.Home_LevelOneCategoryUrl).then(function (res2) {
      if (res2.code == 200) {
        var arr = res2.result.list;
        for (var i = 0; i <= arr.length - 1; i++) {
          if (arr[i].id == pid) {
            var tName = arr[i].catalogname
            console.log(tName)
            _this.setData({
              tagname: tName
            })
          }
        }
      }
    })
  },
})